const { execSync } = require('child_process')

module.exports = () => {
  let username, email;
  try {
    username = execSync('git config --get user.name');
    email = execSync('git config --get user.email');
  } catch (error) {
    throw new Error(error);
  }
  username = username
    ? username.toString().trim()
    : 'username';
  email = email
    ? (' <' + email.toString().trim() + '>')
    : '<email@gmail.com>';

  return `${username} ${email}`; // format: `username <email@gmail.com>`
}

